import './assets/font/iconfont.css';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css'; //暗黑
import './assets/style/reset.scss';

import { createApp, type Directive } from 'vue';
import { createPinia } from 'pinia';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import ElementPlus from 'element-plus';
import ElementPlusX from 'vue-element-plus-x';
import DeerWhaleMaterial from '@/components/index';
import App from './App.vue';
import router from './router';
import { init as monacoWorkerInit } from './utils/monaco-worker';
import zhCn from 'element-plus/es/locale/lang/zh-cn.mjs';
const app = createApp(App);
monacoWorkerInit();
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
app.use(ElementPlus, {
  locale: zhCn,
});

app.use(ElementPlusX);

app.use(DeerWhaleMaterial);
app.use(createPinia());
app.use(router);

// 自定义指令
import * as directives from '@/directives';
Object.keys(directives).forEach((key) => {
  app.directive(key, (directives as { [key: string]: Directive })[key]);
});
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
window.app = app;
app.mount('#app');
